<?php
session_start();
$User_ID=$_SESSION['User_ID'];
?>
<?php

require_once("includes/database.php"); 




if (!empty($_POST['date_of_consultation_add']))
	{
	}
else
{
   $message = "Check your Inputs! All Fields are Required!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php';</script>";
     die( print_r( mysql_error(), true));
}
{	

$select_veterinarian_add_history = trim ($_POST['select_veterinarian_add_history']);
$date_of_consultation_add = trim ($_POST['date_of_consultation_add']);
$time_of_consultation_add = trim ($_POST['time_of_consultation_add']);
$owner_User_ID_history = trim ($_POST['owner_User_ID_history']);
$pet_ID_history = trim ($_POST['pet_ID_history']);
$diagnosis = trim ($_POST['diagnosis']);
$prescription = trim ($_POST['prescription']);
$notes = trim ($_POST['notes']);
date_default_timezone_set ("Asia/Hong_Kong");
$timezone= date_default_timezone_get();
$date =date("h:i:a");


$tsql="INSERT INTO consultation_history_db(Date,Diagnosis,Prescription,Notes,Pet_ID,Owner_User_ID,Veterinarian) 
Values('{$date_of_consultation_add}<br>Time: {$time_of_consultation_add}','{$diagnosis}','{$prescription}','{$notes}','{$pet_ID_history}','{$owner_User_ID_history}','Dr. {$select_veterinarian_add_history}')";

//sendEmail(getEmail($owner_User_ID_add),"Updated Immunization Date","From Petformance");

$data =  mysql_query($tsql,$con);

if( $data )
{
    /*echo "Connection established.\n";*/
	 $message = "Adding Consultation History Successful!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php?page=1&pet_id=';</script>";
}
else
{
   $message = "Adding Consultation History Failed!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php?page=1&pet_id=';</script>";
     die( print_r( mysql_error(), true));
}
}

?>